package com.ydgk.dao;

import com.ydgk.bean.Pre_order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Pre_orderMapper {

    int findCountByFid(int fid);

    @Select("select count(*) from pre_order where fk_fkid = #{fkid} and o_oid != null")
    int findCountByFkid(int fkid);

    void insert(Pre_order pre_order);

    @Select("select count(*) from pre_order where u_uid = #{uid} and o_oid is null")
    int getPreCount(Integer uid);

    @Select("select * from pre_order where u_uid = #{uid} and o_oid is null")
    List<Pre_order> getPre(Integer uid);

    @Delete("delete from pre_order where poid = #{poid}")
    void deleteById(Integer poid);

    @Update("update pre_order set count = #{count}, o_oid = #{o_oid} where poid = #{poid}")
    void updateById(Pre_order pre_order);

    @Select("select * from pre_order where poid = #{poid}")
    Pre_order findPreById(Integer poid);

    @Select("select * from pre_order where fk_fkid = #{fk_fkid}")
    List<Pre_order> getPreByFkid(Integer fk_fkid);

    @Select("select * from pre_order where o_oid = #{oid}")
    List<Pre_order> findByOid(Integer oid);

    @Delete("delete from pre_order where o_oid = #{oid}")
    void deleteByOid(Integer oid);

    List<Pre_order> getNPres(Integer fkid);

    List<Pre_order> getLMPres(Integer fkid);
}
